﻿using AvalonDock.Layout;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using 雷赛板卡上位机.View;
using 雷赛板卡上位机.ViewModel;

namespace 雷赛板卡上位机.Utilities
{
    public class CustomTemplateSelector : DataTemplateSelector
    {
        // 定义不同模板
        public DataTemplate InputTextBoxTemplate { get; set; }
        public DataTemplate AxisControlViewTemplate { get; set; }

        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            if (item is LayoutDocument layoutDoc)
            {
                switch (layoutDoc.Content)
                {
                    case InputTextBoxViewModel inputTextBox: return InputTextBoxTemplate;
                    case AxisControlViewModel axisControl: return AxisControlViewTemplate;
                }
            }

            return base.SelectTemplate(item, container);
        }
    }
}
